
const arr = [24, 29, 19, 47, 78, 99, 71, 47]

const quickSort = (src, start, end) => {
    if (start < end) {
        let key = src[start];
        let i = start;
        let j = end;
        while (i < j) {
            while (i < j && src[j] > key) {
                j--;
            }
            if (i < j) {
                src[i] = src[j];
                i++;
            }

            while (i < j && src[i] < key) {
                i++;
            }
            if (i < j) {
                src[j] = src[i];
                j--;
            }

        }
        src[i] = key;
        quickSort(src, start, i - 1);
        quickSort(src, i + 1, end);
    }
}

quickSort(arr, 0, arr.length - 1);
console.log(arr);